package behavior.command;

import behavior.command.impl.CommandChange;
import behavior.command.impl.CommandOff;
import behavior.command.impl.CommandOn;

public class CommandTest {

	public static void main(String[] args) {
		// 命令接收者
		Television tv = new Television();
		// 开机命令
		CommandOn on = new CommandOn(tv);
		// 关机命令
		CommandOff off = new CommandOff(tv);
		// 频道切换命令
		CommandChange channel = new CommandChange(tv, 2);
		// 命令控制对象
		RemoteControl control = new RemoteControl(on, off, channel);
		// 开机
		control.turnOn();
		// 切换频道
		control.changeChannel();
		// 关机
		control.turnOff();
	}
}
